﻿<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>

<script runat="server">
//{TransportId}{HotelId}
    void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute("home", "", "~/Index.aspx");
        routes.MapPageRoute("about", "gioi-thieu.html", "~/About.aspx");
        routes.MapPageRoute("booking", "dat-tour-{TourId}.html", "~/BookingTour1.aspx");
        routes.MapPageRoute("register", "dang-ky-thanh-vien.html", "~/Register.aspx");
        routes.MapPageRoute("ShoppingCart", "gio-hang.html", "~/CartManager.aspx");
        routes.MapPageRoute("tourdetal", "chi-tiet/{tourname}-{TourId}.html", "~/TourDetail.aspx");
        routes.MapPageRoute("tourlist", "{categoryname}-{CategoryId}.html", "~/Tour.aspx");
        routes.MapPageRoute("dulich", "{categoryname}/{locationname}-{LocationId}.html", "~/Tour.aspx");
        
        routes.MapPageRoute("News", "tin-tuc/{titlename}-{id}.html", "~/News.aspx");
        routes.MapPageRoute("Search", "tim-kiem/ket-qua.html", "~/Search.aspx");

    }
    void Application_BeginRequest(object sender, EventArgs e)
    {
        // I18N
        String language = "vi-VN";
        if (Request["Language"] != null)
        {
            language = Request["Language"];

            var cki = new HttpCookie("ckiLanguage", language);
            cki.Expires = DateTime.Now.AddMonths(1);
            Response.Cookies.Add(cki);

            Request.Cookies.Add(cki);
        }
        else if (Request.Cookies["ckiLanguage"] != null)
        {
            language = Request.Cookies["ckiLanguage"].Value;
        }
        System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(language);
        System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
        System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(language);
    }

    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        RegisterRoutes(RouteTable.Routes);
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown

    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started

    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
       
</script>
